﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CH.Easy.DbProvider.Core;
using CH.Easy.DbProvider.Entity;
using CH.Easy.DbProvider.Interface;
using System.Data.Objects.DataClasses;
using System.Diagnostics;
using CH.Easy.DbProvider.Mapping;

namespace CH.Easy.DbProvider.Test
{

    #region Entity
    [TableMapping(Name = "Member", PrimaryKey = "ID", IsIdentity = true)]
    public class Member
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        public int Age { get; set; }
        public DateTime AddTime { get; set; }
        public int Level { get; set; }
    }

    [TableMapping(Name = "Photo", PrimaryKey = "ID", IsIdentity = true)]
    public class Photo
    {
        public int ID { get; set; }
        public string Title { get; set; }
        public string Url { get; set; }
        public int MemberID { get; set; }
        public string Desc { get; set; }
    }


    #endregion

    public class CHEasyCMS : DbContext
    {
        public IDbTable<Member> Member
        {
            get
            {
                return this.GetTable<Member>();
            }
        }
        public IDbTable<Photo> Photo
        {
            get
            {
                return this.GetTable<Photo>();
            }
        }
    }
}
